package com.super8.super8newtv.bean;

import android.text.TextUtils;

import com.google.gson.Gson;

/**
 * 业务描述:api接口返回响应数据
 *
 * @创 建 人: zhangl
 * @创建时间: 2020-07-07 15:42:21
 */
public class ResponseBean<T> {
    //     * pageIndex : 1
//            * pageSize : 10
//            * pageCount : 1
//            * totalCount : 10
//            * Data :
//            * Error : 00
//            * error_description : 操作成功
//     */
    private int code;
    private int pageIndex;
    private int pageSize;
    private int pageCount;
    private int totalCount;
    private String Error;
    private String error_description;
    private T Data;

    //响应数据是否有误
    public boolean isSuccess(){
        if (!TextUtils.isEmpty(this.Error)&&this.Error.equals("00"))
            return true;
        else
            return false;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public String getError() {
        return Error;
    }

    public void setError(String error) {
        this.Error = error;
    }

    public String getError_description() {
        return error_description;
    }

    public void setError_description(String error_description) {
        this.error_description = error_description;
    }

    public T getData() {
        return Data;
    }

    public void setData(T data) {
        this.Data = data;
    }

    @Override
    public String toString() {
        return "ResponseData{" +
                "pageIndex=" + pageIndex +
                ", pageSize=" + pageSize +
                ", pageCount=" + pageCount +
                ", totalCount=" + totalCount +
                ", code=" + code +
                ", error='" + Error + '\'' +
                ", error_description='" + error_description + '\'' +
                ", data=" + new Gson().toJson(Data)+
                '}';
    }
}
